package com.zlzxm.sorting.ui.activity

import android.util.DisplayMetrics
import android.view.View
import android.widget.AdapterView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.viewbinding.ViewBinding
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zlzxm.sorting.R
import com.zlzxm.sorting.databinding.AcStartBinding
import com.zlzxm.sorting.globe.startPage
import com.zlzxm.sorting.util.ui.manager.AbsAcBase


/**
 *
 *CREATE BY zlzxm ON 2022/7/4
 *
 */
class AcStart: AbsAcBase() {


    val bind by lazy {

        AcStartBinding.inflate(layoutInflater)

    }

    override fun initBinding(): ViewBinding? {

        return bind
    }


    override fun initViewModel() {


    }

    override fun initView() {

        bind.rv.layoutManager = LinearLayoutManager(this)
        val adapter = Myadapter()
        bind.rv.adapter  = adapter


        val list = mutableListOf<String>()

        list.add("首页")
        list.add("分拣")
        list.add("赛选")
        list.add("登录")
        list.add("注册")
        list.add("找回")
        list.add("设置")
        list.add("操作")
        list.add("操作")
        adapter.setNewInstance(list)

        adapter.setOnItemClickListener { adapter, view, position ->
            run {

                when (position) {
                    0 -> {

                        startPage(AcIndex::class.java)

                    }
                    1 -> {
                        startPage(AcSortingByProduct::class.java)

                    }
                    2 -> {
                        startPage(AcSortingByMerchant::class.java)

                    }
                    3 -> {
                        startPage(AcLogin::class.java)

                    }

                    4 -> {
                        startPage(AcRegister::class.java)

                    }


                    5 -> {
                        startPage(AcFindPassword::class.java)

                    }

                    6 -> {
                        startPage(AcSetting::class.java)

                    }

                    7 -> {
                        startPage(AcCaozuo::class.java)

                    }

                    8 -> {
                        startPage(AcCaoZuoProduct::class.java)

                    }

                }


            }
        }


    }

    override fun initData() {




    }


    inner class  Myadapter : BaseQuickAdapter<String,BaseViewHolder>(R.layout.item_strat){
        override fun convert(holder: BaseViewHolder, item: String) {
            holder.setText(R.id.tvName,item)
        }


    }


}